Skip to content

fix: rewrite re-export sources to selectors - #131

Open
bmv437 wants to merge 1 commit into
cloudscape-design:mainfrom
bmv437:fix/converter-rewrite-reexport-sources
Open

fix: rewrite re-export sources to selectors#131
bmv437 wants to merge 1 commit into
cloudscape-design:mainfrom
bmv437:fix/converter-rewrite-reexport-sources

Conversation

@bmv437

@bmv437 bmv437 commented Jul 31, 2026

Copy link
Copy Markdown

Issue #, if available:

Description of changes:

Description

The selectors converter only rewrote module paths on import declarations, so re-export
declarations pointing at a Cloudscape /dom entry were left alone. A wrapper written as
export { default } from '@cloudscape-design/components/test-utils/dom/button' produced a
selectors variant that still pointed at the DOM wrapper, which breaks selectors generation for
consumers that build their own scoped test-utils.

This PR applies the same /dom -> /selectors rewrite to ExportNamedDeclaration and
ExportAllDeclaration sources. The shared logic moved into a small helper so imports and
re-exports stay in sync. Local exports such as export { value } and export default value have
no module source and are left untouched.

How has this been tested?

Added a converter input at src/converter/test/inputs/converter-no-typecheck/reexport-source.ts
that covers both re-export forms (export { default } from ... and export * from ...) next to
plain local exports, so one snapshot pins both halves of the behavior: the re-export sources get
rewritten, and the local exports are left alone.

Reviewers can run npm test (11 files, 92 tests) and read the new reexport-source 1 entry in
src/converter/test/__snapshots__/converter.test.ts.snap, where the two re-exports now resolve to
.../test-utils/selectors/button and .../test-utils/selectors/container.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@bmv437
bmv437 requested a review from a team as a code owner July 31, 2026 20:56
@bmv437
bmv437 requested review from srungta08 and removed request for a team July 31, 2026 20:56
@avinashbot
avinashbot requested review from avinashbot and removed request for srungta08 August 3, 2026 16:06
@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.08%. Comparing base (43f97ee) to head (c9c9e2e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #131      +/-   ##
==========================================
+ Coverage   97.02%   97.08%   +0.06%     
==========================================
  Files           9        9              
  Lines         336      343       +7     
  Branches       72       73       +1     
==========================================
+ Hits          326      333       +7     
  Misses         10       10              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant